import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/views/Layout/index.vue'
import Home from '@/views/Home/index.vue'
import Login from '@/views/Login/index.vue'
import Register from '@/views/Register/index.vue'
import Checkout from '@/views/Checkout/index.vue'
import Detail from '@/views/Detail/index.vue'
import Cart from '@/views/Cart/index.vue'
import Pay from '@/views/Pay/index.vue'
import Order from '@/views/Order/index.vue'
import Category from '@/views/Category/index.vue'


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    { 
      path: '/',
      name: 'layout',
      component: Layout,
      children: [
        { 
          path: '',
          name: 'home',
          component: Home
        },
        {
          path: 'detail/:id',
          name: 'detail',
          component: Detail
        },
        {
          path:'checkout',
          name:'checkout',
          component: Checkout
        },
        {
          path:'cart',
          name:'cart',
          component: Cart
        },
        {
          path:'pay',
          component: Pay
        },
        {
          path:'order',
          component: Order
        },
        {
          path:'category/:id',
          name:'category',
          component: Category
        }
      ] 
    },
    {
      path: '/login',
      name: 'login',
      component: Login
    },
    {
      path: '/register',
      name: 'register',
      component: Register
    },
  ]
})

export default router
